#ifndef APPINI_H_
#define APPINI_H_

#include "BasicConfig.h"
#include "FileFunction.h"
#include "gojobzip.h"
#include "network_get.h"



#define _LOCALWEBGEN_ \
         QString("%1/.webhouse/").arg(QDir::homePath())
         
         
class HtmlDoc : public QThread
{
public:
   HtmlDoc( QObject *parent ) 
    : QThread(parent)
   {
      setTerminationEnabled ( true );
   }
protected:
    void run() { exec(); }
};
         
         
         
         
         
         
         
         
         

/* remove a file */
static inline bool qt_unlink(QString fullFileName)
{
    if (fullFileName.size() > 0) {
    QFile f( fullFileName );
	if ( f.exists(fullFileName) ) {
       if (f.remove()) {
        return true;
       }
	}
    }
return false;
}


/* remove dir recursive */
static inline void DownDir_RM(const QString d)
{
   QDir dir(d);
   //////SqlLog("order to delete dir:"+d+" ");
   if (dir.exists())
   {
      const QFileInfoList list = dir.entryInfoList();
      QFileInfo fi;
      for (int l = 0; l < list.size(); l++)
      {
         fi = list.at(l);
         if (fi.isDir() && fi.fileName() != "." && fi.fileName() != "..")
            DownDir_RM(fi.absoluteFilePath());
         else if (fi.isFile())
         {
            qt_unlink(fi.absoluteFilePath());
            ///////if (!ret) {
               ////////SqlLog("Can't remove: " + fi.absoluteFilePath() + " (write-protect?)");
         } 
        
      }
     /////// SqlLog("Remove: " + d + " ");
      dir.rmdir(d);
      
   }
} 



#endif /*CONFIG_H_*/
